import socket
host = '127.0.0.1'
port = 8080
web = socket.socket()
web.bind((host,port))
web.listen(5)
print('等待服务器连接:...')

while True:  # 接收新连接循环
    conn,addr = web.accept()
    with conn:
        data = conn.recv(1024)
        if not data:
            conn.close()
            break
        print(f'服务器{addr}传输的数据是{data}')
        conn.sendall(b'HTTP/1.1 200 OK\r\n\r\nHello World')

    

